import java.io.*;

public class FileDisplayImpl extends DisplayImpl {

    File file = null;
    FileInputStream fileInputStream = null;

    public FileDisplayImpl(String filename){
        file = new File(filename);
    }

    @Override
    public void openImpl() {
        try {
            fileInputStream = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void printImpl() {
        byte[] bytes = new byte[1024];
        try {
            fileInputStream.read(bytes);
            System.out.println(new String(bytes));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void closeImpl() {
        try {
            fileInputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
